﻿@{
    Html.LOBHtmlHelper().SetLayout(this);
}
@{Html.RenderPartial("LinkPath");}

<div class="mtitle">
    @ViewBag.Title 
</div>

@Html.LOBHtmlHelper().Busy("busyMain")

<table  cellpadding="1" cellspacing="1" style="table-layout:fixed;" width="100%">
    <tr>
        <td style="width: 100%;height:100%" valign="top">
            @Html.LOBHtmlHelper().GridView()
        </td>
    </tr>
</table>

<script type="text/javascript">

    var _codeBaseGrid = new CodeBaseGrid();
    $(document).ready(function () {
        _codeBaseGrid.Init(
            "grvtblUserAccount",
            "UserGroupID",
            "@Url.Action("View","UserAccount")",
            "@Url.Action("Edit","UserAccount")",
            "@Url.Action("Add","UserAccount")",
            "@Url.Action("Delete","UserAccount")",
            "@Url.Action("Save","UserAccount")",
            "AD",
            "AD_tblUserAccount",
            ""
            );
        _codeBaseGrid.SetWidthPupop(550);
        _codeBaseGrid.SetHeightPupop(480);
    });

    function View(addOnGrid) {
        _codeBaseGrid.View(addOnGrid);
    }

    function Add(addOnGrid) {
        _codeBaseGrid.Add(addOnGrid);
    }

    function Edit(addOnGrid) {
        _codeBaseGrid.Edit(addOnGrid);
    }

    function Delete(addOnGrid) {
        _codeBaseGrid.Delete(addOnGrid);
    }

    function Save() {
        _codeBaseGrid.Save();
    }

    function Undo() {
        _codeBaseGrid.Undo();
    }


    function CustomEnableToolBar(status) {
        document.getElementById('btnPrint').disabled = true;

        
        document.getElementById('btnPrint').className = "disabled";
    }

    function MoreFunctionClick(id) {
        
        if (id == 'mnuAdmin') {
            var current = GetCurrentRow("grvtblUserAccount");
            if (current != null) {
                var data = PostServer('@Url.Action("UpdateAdmin","UserAccount")?UserGroupID=' + current.UserGroupID)
                _codeBaseGrid.refreshData(current.UserGroupID);
            }
        }

        if (id == 'mnuResetPass') {
            var current = GetCurrentRow("grvtblUserAccount");
            if (current != null) {
                ShowWindowCallback('@Url.Action("ReSetPassword","UserAccount")?UserGroupID=' + current.UserGroupID, 400, 140, '@Html.LOBHtmlHelper().C("ResetPassword")');
            }
        }
    }
</script>
